<?php

require_once '../mysqlConnect.php';

if (isset($_POST['icd_nine_entry_id']) && isset($_POST['icd_code_id']) && isset($_POST['record_date'])) {

	
	$sql = "UPDATE icd_nine_entry SET code_id = :codeId, date_given = :date WHERE id = :id LIMIT 1";

	$conn = GetPDOConnection();
	
	try {
		$sth = $conn->prepare($sql);
		$sth->bindValue(":codeId", $_POST['icd_code_id'][0]);
		$sth->bindValue(":date", $_POST['record_date']);
		$sth->bindValue(":id", $_POST['icd_nine_entry_id']);
		$sth->execute();
		$returnValue = "success";
	} catch (PDOException $e) {
		$returnValue = $e->getMessage();
	}

	echo $returnValue;
} else
	echo "fail";